#include <stdio.h>
#include "loop.h"
#include "promise.h"

void hello(void * promise, void * num)
{
    printf("hello %llu\n", (unsigned long long)num);
    resolve_promise(promise, (void *)((unsigned long long)num + 1));
}

void do_loop(void * _)
{
    void * p1 = new_promise(hello, (void *)1);
    void * p2 = then_promise(p1, hello);
    void * p3 = then_promise(p2, hello);
    then_free_promises(p3);
}

int main(void)
{
    loop(do_loop, NULL);
    return 0;
}
